﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CocisDAL;
using System.Web.UI;
using CocisModel;

namespace CocisWeb.src
{
    public class BasePage :Page
    {
        private string errmessagecode = "";
        public UserInfo LoginUser
        {
            get { return Session["userInfo"] as UserInfo; }
        }        

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (!checkvalue())
            {
                string returnurl = "";
                if (errmessagecode == "1")
                {
                    returnurl = Constant.OverTimePage + "?" + Constant.ErrMessage + "=" + Server.HtmlEncode(Constant.OverTime);
                }
                else
                {
                    returnurl = Constant.OverTimePage + "?" + Constant.ErrMessage + "=" + Server.HtmlEncode(Constant.OverTime);
                   // Response.Redirect(returnurl, true);
 
                } 
                
            }
        }
        #region 验证

        protected virtual bool checkvalue()
        {
            
            if (Session["login"] != null)
            {
                this.errmessagecode = "1"; return false;                      
            }
            else return false;
        }
        #endregion
    }
}
